﻿using Shop.RemoteModel.Goods;
using Shop.RemoteModel.Goods.Model;
using Shop.RemoteModel.SpuGoods;
using Shop.RemoteModel.SpuGoods.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class GoodsEvent : IRpcApiService
    {
        private readonly IGoodsService _Service;

        public GoodsEvent ( IGoodsService service )
        {
            this._Service = service;
        }
        public SpuDatum[] GetTopGoods ( GetTopGoods obj )
        {
            return _Service.Gets(obj.Param);
        }
        public GoodsDto[] GetGoodsList ( GetGoodsList obj )
        {
            return this._Service.Gets(obj.Ids);
        }
        public void PublicGoods ( PublicGoods obj )
        {
            this._Service.Public(obj.Id, obj.OpUserId, obj.StockNum);
        }
        public void OffshelfGoods ( OffshelfGoods obj )
        {
            this._Service.OffShelf(obj.Id);
        }
        public long AddGoods ( AddGoods add )
        {
            return this._Service.Add(add.Datum);
        }
        public bool SetGoods ( SetGoods obj )
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
        public GoodsDatum GetGoods ( GetGoods obj )
        {
            return this._Service.GetDatum(obj.Id);
        }
        public PagingResult<GoodsDto> QueryGoods ( QueryGoods obj )
        {
            return this._Service.Query(obj.QueryParam, obj.ToBasicPage());
        }
        public void DeleteGoods ( DeleteGoods obj )
        {
            this._Service.Delete(obj.Id);
        }
    }
}
